<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>/home/zjh/git/Koala-UI/KoalaUI/WebContent/lib/Koala_Slider.js</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
            
                <h1><img src="../assets/css/logo.png" title=""></h1>
            
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: </em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
    <h2 class="off-left">APIs</h2>
    <div id="api-tabview" class="tabview">
        <ul class="tabs">
            <li><a href="#api-classes">Classes</a></li>
            <li><a href="#api-modules">Modules</a></li>
        </ul>

        <div id="api-tabview-filter">
            <input type="search" id="api-filter" placeholder="Type to filter APIs">
        </div>

        <div id="api-tabview-panel">
            <ul id="api-classes" class="apis classes">
            
                <li><a href="../classes/Accordion.html">Accordion</a></li>
            
                <li><a href="../classes/AutoComplete.html">AutoComplete</a></li>
            
                <li><a href="../classes/Button.html">Button</a></li>
            
                <li><a href="../classes/Carousel.html">Carousel</a></li>
            
                <li><a href="../classes/ColorPicker.html">ColorPicker</a></li>
            
                <li><a href="../classes/Combobox.html">Combobox</a></li>
            
                <li><a href="../classes/DateTimePicker.html">DateTimePicker</a></li>
            
                <li><a href="../classes/Grid.html">Grid</a></li>
            
                <li><a href="../classes/ListView.html">ListView</a></li>
            
                <li><a href="../classes/Popover.html">Popover</a></li>
            
                <li><a href="../classes/ProgressBar.html">ProgressBar</a></li>
            
                <li><a href="../classes/RichTextEditor.html">RichTextEditor</a></li>
            
                <li><a href="../classes/ScrollSpy.html">ScrollSpy</a></li>
            
                <li><a href="../classes/Select.html">Select</a></li>
            
                <li><a href="../classes/SideBar.html">SideBar</a></li>
            
                <li><a href="../classes/Slider.html">Slider</a></li>
            
                <li><a href="../classes/Spinner.html">Spinner</a></li>
            
                <li><a href="../classes/Tab.html">Tab</a></li>
            
                <li><a href="../classes/ToolBar.html">ToolBar</a></li>
            
                <li><a href="../classes/Tooltip.html">Tooltip</a></li>
            
                <li><a href="../classes/Tree.html">Tree</a></li>
            
                <li><a href="../classes/Wizard.html">Wizard</a></li>
            
            </ul>

            <ul id="api-modules" class="apis modules">
            
            </ul>
        </div>
    </div>
</div>

            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
        Show:
        <label for="api-show-inherited">
            <input type="checkbox" id="api-show-inherited" checked>
            Inherited
        </label>

        <label for="api-show-protected">
            <input type="checkbox" id="api-show-protected">
            Protected
        </label>

        <label for="api-show-private">
            <input type="checkbox" id="api-show-private">
            Private
        </label>
        <label for="api-show-deprecated">
            <input type="checkbox" id="api-show-deprecated">
            Deprecated
        </label>

    </div>


            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
                        <h1 class="file-heading">File: /home/zjh/git/Koala-UI/KoalaUI/WebContent/lib/Koala_Slider.js</h1>

<div class="file">
    <pre class="code prettyprint linenums">
/**
 * @author zjh
 * 
 */
(function( $ ) {

	var ErrorMsgs = {
		formatInvalidInputErrorMsg : function(input) {
			return &quot;你输入的:&quot; + input + &quot;不是合法的值&quot;;
		},
		callingContextNotSliderInstance : &quot;滑动条并未初始化&quot;
	};

	/**
	 * 滑动条组件,取自其他开源组件
	 * @class Slider
	 * @constructor
	 * @example
	 * 	js代码
	 * 	$(&#x27;#ex1&#x27;).slider({
	 * 		
	    });
	    
	   	html代码
	   	&lt;div class=&quot;well&quot;&gt;
			&lt;input id=&quot;ex1&quot;/&gt;
		&lt;/div&gt;
	 */
	var Slider = function(element, options) {
		var el = this.element = $(element).hide();
		var origWidth =  $(element)[0].style.width;

		var updateSlider = false;
		var parent = this.element.parent();


		if (parent.hasClass(&#x27;slider&#x27;) === true) {
			updateSlider = true;
			this.picker = parent;
		} else {
			this.picker = $(&#x27;&lt;div class=&quot;slider&quot;&gt;&#x27;+
								&#x27;&lt;div class=&quot;slider-track&quot;&gt;&#x27;+
									&#x27;&lt;div class=&quot;slider-selection&quot;&gt;&lt;/div&gt;&#x27;+
									&#x27;&lt;div class=&quot;slider-handle&quot;&gt;&lt;/div&gt;&#x27;+
									&#x27;&lt;div class=&quot;slider-handle&quot;&gt;&lt;/div&gt;&#x27;+
								&#x27;&lt;/div&gt;&#x27;+
								&#x27;&lt;div class=&quot;tooltip&quot;&gt;&lt;div class=&quot;tooltip-arrow&quot;&gt;&lt;/div&gt;&lt;div class=&quot;tooltip-inner&quot;&gt;&lt;/div&gt;&lt;/div&gt;&#x27;+
							&#x27;&lt;/div&gt;&#x27;)
								.insertBefore(this.element)
								.append(this.element);
		}

		this.id = this.element.data(&#x27;slider-id&#x27;)||options.id;
		if (this.id) {
			this.picker[0].id = this.id;
		}

		if (typeof Modernizr !== &#x27;undefined&#x27; &amp;&amp; Modernizr.touch) {
			this.touchCapable = true;
		}

		var tooltip = this.element.data(&#x27;slider-tooltip&#x27;)||options.tooltip;

		this.tooltip = this.picker.find(&#x27;.tooltip&#x27;);
		this.tooltipInner = this.tooltip.find(&#x27;div.tooltip-inner&#x27;);

		this.orientation = this.element.data(&#x27;slider-orientation&#x27;)||options.orientation;
		switch(this.orientation) {
			case &#x27;vertical&#x27;:
				this.picker.addClass(&#x27;slider-vertical&#x27;);
				this.stylePos = &#x27;top&#x27;;
				this.mousePos = &#x27;pageY&#x27;;
				this.sizePos = &#x27;offsetHeight&#x27;;
				this.tooltip.addClass(&#x27;right&#x27;)[0].style.left = &#x27;100%&#x27;;
				break;
			default:
				this.picker
					.addClass(&#x27;slider-horizontal&#x27;)
					.css(&#x27;width&#x27;, origWidth);
				this.orientation = &#x27;horizontal&#x27;;
				this.stylePos = &#x27;left&#x27;;
				this.mousePos = &#x27;pageX&#x27;;
				this.sizePos = &#x27;offsetWidth&#x27;;
				this.tooltip.addClass(&#x27;top&#x27;)[0].style.top = -this.tooltip.outerHeight() - 14 + &#x27;px&#x27;;
				break;
		}

		var self = this;
		$.each([&#x27;min&#x27;, &#x27;max&#x27;, &#x27;step&#x27;, &#x27;value&#x27;], function(i, attr) {
			if (typeof el.data(&#x27;slider-&#x27; + attr) !== &#x27;undefined&#x27;) {
				self[attr] = el.data(&#x27;slider-&#x27; + attr);
			} else if (typeof options[attr] !== &#x27;undefined&#x27;) {
				self[attr] = options[attr];
			} else if (typeof el.prop(attr) !== &#x27;undefined&#x27;) {
				self[attr] = el.prop(attr);
			} else {
				self[attr] = 0; // to prevent empty string issues in calculations in IE
			}
		});

		if (this.value instanceof Array) {
			this.range = true;
		}

		this.selection = this.element.data(&#x27;slider-selection&#x27;)||options.selection;
		this.selectionEl = this.picker.find(&#x27;.slider-selection&#x27;);
		if (this.selection === &#x27;none&#x27;) {
			this.selectionEl.addClass(&#x27;hide&#x27;);
		}

		this.selectionElStyle = this.selectionEl[0].style;

		this.handle1 = this.picker.find(&#x27;.slider-handle:first&#x27;);
		this.handle1Stype = this.handle1[0].style;

		this.handle2 = this.picker.find(&#x27;.slider-handle:last&#x27;);
		this.handle2Stype = this.handle2[0].style;

		var handle = this.element.data(&#x27;slider-handle&#x27;)||options.handle;
		switch(handle) {
			case &#x27;round&#x27;:
				this.handle1.addClass(&#x27;round&#x27;);
				this.handle2.addClass(&#x27;round&#x27;);
				break;
			case &#x27;triangle&#x27;:
				this.handle1.addClass(&#x27;triangle&#x27;);
				this.handle2.addClass(&#x27;triangle&#x27;);
				break;
		}

		if (this.range) {
			this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0]));
			this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1]));
		} else {
			this.value = [ Math.max(this.min, Math.min(this.max, this.value))];
			this.handle2.addClass(&#x27;hide&#x27;);
			if (this.selection === &#x27;after&#x27;) {
				this.value[1] = this.max;
			} else {
				this.value[1] = this.min;
			}
		}
		this.diff = this.max - this.min;
		this.percentage = [
			(this.value[0]-this.min)*100/this.diff,
			(this.value[1]-this.min)*100/this.diff,
			this.step*100/this.diff
		];

		this.offset = this.picker.offset();
		this.size = this.picker[0][this.sizePos];

		this.formater = options.formater;

		this.reversed = this.element.data(&#x27;slider-reversed&#x27;)||options.reversed;

		this.layout();

		this.handle1.on({
			keydown: $.proxy(this.keydown, this, 0),
			mousedown: $.proxy(this.triggerFocusOnHandle, this, 0)
		});

		this.handle2.on({
			keydown: $.proxy(this.keydown, this, 1),
			mousedown: $.proxy(this.triggerFocusOnHandle, this, 1)
		});

		if (this.touchCapable) {
			// Touch: Bind touch events:
			this.picker.on({
				touchstart: $.proxy(this.mousedown, this)
			});
		} else {
			this.picker.on({
				mousedown: $.proxy(this.mousedown, this)
			});
		}

		if(tooltip === &#x27;hide&#x27;) {
			this.tooltip.addClass(&#x27;hide&#x27;);
		} else if(tooltip === &#x27;always&#x27;) {
			this.showTooltip();
			this.alwaysShowTooltip = true;
		} else {
			this.picker.on({
				mouseenter: $.proxy(this.showTooltip, this),
				mouseleave: $.proxy(this.hideTooltip, this)
			});
			this.handle1.on({
				focus: $.proxy(this.showTooltip, this),
				blur: $.proxy(this.hideTooltip, this)
			});
			this.handle2.on({
				focus: $.proxy(this.showTooltip, this),
				blur: $.proxy(this.hideTooltip, this)
			});
		}

		this.enabled = options.enabled &amp;&amp; 
						(this.element.data(&#x27;slider-enabled&#x27;) === undefined || this.element.data(&#x27;slider-enabled&#x27;) === true);
		if(this.enabled) {
			this.enable();
		} else {
			this.disable();
		}
	};

	Slider.prototype = {
		constructor: Slider,

		over: false,
		inDrag: false,
		
		/**
		 * 显示提示框
		 * @method showToolTip
		 */
		showTooltip: function(){
			this.tooltip.addClass(&#x27;in&#x27;);
			this.over = true;
		},
		
		/**
		 * 隐藏提示框
		 * @method showToolTip
		 */
		hideTooltip: function(){
			if (this.inDrag === false &amp;&amp; this.alwaysShowTooltip !== true) {
				this.tooltip.removeClass(&#x27;in&#x27;);
			}
			this.over = false;
		},

		layout: function(){
			var positionPercentages;

			if(this.reversed) {
				positionPercentages = [ 100 - this.percentage[0], this.percentage[1] ];
			} else {
				positionPercentages = [ this.percentage[0], this.percentage[1] ];
			}

			this.handle1Stype[this.stylePos] = positionPercentages[0]+&#x27;%&#x27;;
			this.handle2Stype[this.stylePos] = positionPercentages[1]+&#x27;%&#x27;;

			if (this.orientation === &#x27;vertical&#x27;) {
				this.selectionElStyle.top = Math.min(positionPercentages[0], positionPercentages[1]) +&#x27;%&#x27;;
				this.selectionElStyle.height = Math.abs(positionPercentages[0] - positionPercentages[1]) +&#x27;%&#x27;;
			} else {
				this.selectionElStyle.left = Math.min(positionPercentages[0], positionPercentages[1]) +&#x27;%&#x27;;
				this.selectionElStyle.width = Math.abs(positionPercentages[0] - positionPercentages[1]) +&#x27;%&#x27;;
			}

			if (this.range) {
				this.tooltipInner.text(
					this.formater(this.value[0]) + &#x27; : &#x27; + this.formater(this.value[1])
				);
				this.tooltip[0].style[this.stylePos] = this.size * (positionPercentages[0] + (positionPercentages[1] - positionPercentages[0])/2)/100 - (this.orientation === &#x27;vertical&#x27; ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +&#x27;px&#x27;;
			} else {
				this.tooltipInner.text(
					this.formater(this.value[0])
				);
				this.tooltip[0].style[this.stylePos] = this.size * positionPercentages[0]/100 - (this.orientation === &#x27;vertical&#x27; ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +&#x27;px&#x27;;
			}
		},

		
		mousedown: function(ev) {
			if(!this.isEnabled()) {
				return false;
			}
			// Touch: Get the original event:
			if (this.touchCapable &amp;&amp; ev.type === &#x27;touchstart&#x27;) {
				ev = ev.originalEvent;
			}

			this.triggerFocusOnHandle();

			this.offset = this.picker.offset();
			this.size = this.picker[0][this.sizePos];

			var percentage = this.getPercentage(ev);

			if (this.range) {
				var diff1 = Math.abs(this.percentage[0] - percentage);
				var diff2 = Math.abs(this.percentage[1] - percentage);
				this.dragged = (diff1 &lt; diff2) ? 0 : 1;
			} else {
				this.dragged = 0;
			}

			this.percentage[this.dragged] = this.reversed ? 100 - percentage : percentage;
			this.layout();

			if (this.touchCapable) {
				// Touch: Bind touch events:
				$(document).on({
					touchmove: $.proxy(this.mousemove, this),
					touchend: $.proxy(this.mouseup, this)
				});
			} else {
				$(document).on({
					mousemove: $.proxy(this.mousemove, this),
					mouseup: $.proxy(this.mouseup, this)
				});
			}

			this.inDrag = true;
			var val = this.calculateValue();
			this.setValue(val);
			this.element.trigger({
					type: &#x27;slideStart&#x27;,
					value: val
				}).trigger({
					type: &#x27;slide&#x27;,
					value: val
				});
			return false;
		},

		triggerFocusOnHandle: function(handleIdx) {
			if(handleIdx === 0) {
				this.handle1.focus();
			} 
			if(handleIdx === 1) {
				this.handle2.focus();
			}
			return false;
		},

		keydown: function(handleIdx, ev) {
			if(!this.isEnabled()) {
				return false;
			}

			var dir;
			switch (ev.which) {
				case 37: // left
				case 40: // down
					dir = -1;
					break;
				case 39: // right
				case 38: // up
					dir = 1;
					break;
			}
			if (!dir) {
				return;
			}

			var oneStepValuePercentageChange = dir * this.percentage[2];
			var percentage = this.percentage[handleIdx] + oneStepValuePercentageChange;

			if (percentage &gt; 100) {
				percentage = 100;
			} else if (percentage &lt; 0) {
				percentage = 0;
			}

			this.dragged = handleIdx;
			this.adjustPercentageForRangeSliders(percentage);
			this.percentage[this.dragged] = percentage;
			this.layout();

			var val = this.calculateValue();
			this.setValue(val);
			this.element
				.trigger({
					type: &#x27;slide&#x27;,
					value: val
				})
				.trigger({
					type: &#x27;slideStop&#x27;,
					value: val
				})
				.data(&#x27;value&#x27;, val)
				.prop(&#x27;value&#x27;, val);
			return false;
		},

		mousemove: function(ev) {
			if(!this.isEnabled()) {
				return false;
			}
			// Touch: Get the original event:
			if (this.touchCapable &amp;&amp; ev.type === &#x27;touchmove&#x27;) {
				ev = ev.originalEvent;
			}
			
			var percentage = this.getPercentage(ev);
			this.adjustPercentageForRangeSliders(percentage);
			this.percentage[this.dragged] = this.reversed ? 100 - percentage : percentage;
			this.layout();

			var val = this.calculateValue();
			this.setValue(val);
			this.element
				.trigger({
					type: &#x27;slide&#x27;,
					value: val
				})
				.data(&#x27;value&#x27;, val)
				.prop(&#x27;value&#x27;, val);
			return false;
		},

		adjustPercentageForRangeSliders: function(percentage) {
			if (this.range) {
				if (this.dragged === 0 &amp;&amp; this.percentage[1] &lt; percentage) {
					this.percentage[0] = this.percentage[1];
					this.dragged = 1;
				} else if (this.dragged === 1 &amp;&amp; this.percentage[0] &gt; percentage) {
					this.percentage[1] = this.percentage[0];
					this.dragged = 0;
				}
			}
		},

		mouseup: function() {
			if(!this.isEnabled()) {
				return false;
			}
			if (this.touchCapable) {
				// Touch: Bind touch events:
				$(document).off({
					touchmove: this.mousemove,
					touchend: this.mouseup
				});
			} else {
				$(document).off({
					mousemove: this.mousemove,
					mouseup: this.mouseup
				});
			}

			this.inDrag = false;
			if (this.over === false) {
				this.hideTooltip();
			}
			var val = this.calculateValue();
			this.layout();
			this.element
				.data(&#x27;value&#x27;, val)
				.prop(&#x27;value&#x27;, val)
				.trigger({
					type: &#x27;slideStop&#x27;,
					value: val
				});
			return false;
		},

		calculateValue: function() {
			var val;
			if (this.range) {
				val = [this.min,this.max];
                if (this.percentage[0] !== 0){
                    val[0] = (Math.max(this.min, this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step));
                }
                if (this.percentage[1] !== 100){
                    val[1] = (Math.min(this.max, this.min + Math.round((this.diff * this.percentage[1]/100)/this.step)*this.step));
                }
				this.value = val;
			} else {
				val = (this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step);
				if (val &lt; this.min) {
					val = this.min;
				}
				else if (val &gt; this.max) {
					val = this.max;
				}
				val = parseFloat(val);
				this.value = [val, this.value[1]];
			}
			return val;
		},

		getPercentage: function(ev) {
			if (this.touchCapable) {
				ev = ev.touches[0];
			}
			var percentage = (ev[this.mousePos] - this.offset[this.stylePos])*100/this.size;
			percentage = Math.round(percentage/this.percentage[2])*this.percentage[2];
			return Math.max(0, Math.min(100, percentage));
		},

		/**
		 * 获取滑动条当前的值
		 * @method getValue
		 * @returns {Integer}
		 */
		getValue: function() {
			if (this.range) {
				return this.value;
			}
			return this.value[0];
		},

		/**
		 * 设置滑动条的值
		 * @method setValue
		 * @param val
		 */
		setValue: function(val) {
			this.value = this.validateInputValue(val);

			if (this.range) {
				this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0]));
				this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1]));
			} else {
				this.value = [ Math.max(this.min, Math.min(this.max, this.value))];
				this.handle2.addClass(&#x27;hide&#x27;);
				if (this.selection === &#x27;after&#x27;) {
					this.value[1] = this.max;
				} else {
					this.value[1] = this.min;
				}
			}
			this.diff = this.max - this.min;
			this.percentage = [
				(this.value[0]-this.min)*100/this.diff,
				(this.value[1]-this.min)*100/this.diff,
				this.step*100/this.diff
			];
			this.layout();

			this.element
				.trigger({
					&#x27;type&#x27;: &#x27;slide&#x27;,
					&#x27;value&#x27;: this.value
				})
				.data(&#x27;value&#x27;, this.value)
				.prop(&#x27;value&#x27;, this.value);
		},

		validateInputValue : function(val) {
			if(typeof val === &#x27;number&#x27;) {
				return val;
			} else if(val instanceof Array) {
				$.each(val, function(i, input) { if (typeof input !== &#x27;number&#x27;) { throw new Error( ErrorMsgs.formatInvalidInputErrorMsg(input) ); }});
				return val;
			} else {
				throw new Error( ErrorMsgs.formatInvalidInputErrorMsg(val) );
			}
		},

		/**
		 * 移除滑动条
		 * @method destroy
		 */
		destroy: function(){
			this.handle1.off();
			this.handle2.off();
			this.element.off().show().insertBefore(this.picker);
			this.picker.off().remove();
			$(this.element).removeData(&#x27;koala.slider&#x27;);
		},

		/**
		 * 使滑动条不可用
		 * @method disable
		 */
		disable: function() {
			this.enabled = false;
			this.handle1.removeAttr(&quot;tabindex&quot;);
			this.handle2.removeAttr(&quot;tabindex&quot;);
			this.picker.addClass(&#x27;slider-disabled&#x27;);
			this.element.trigger(&#x27;slideDisabled&#x27;);
		},

		/**
		 * 使滑动条可用
		 * @method enable
		 */
		enable: function() {
			this.enabled = true;
			this.handle1.attr(&quot;tabindex&quot;, 0);
			this.handle2.attr(&quot;tabindex&quot;, 0);
			this.picker.removeClass(&#x27;slider-disabled&#x27;);
			this.element.trigger(&#x27;slideEnabled&#x27;);
		},

		/**
		 * 切换滑动条的可用/不可用
		 * @method toggle
		 */
		toggle: function() {
			if(this.enabled) {
				this.disable();
			} else {
				this.enable();
			}
		},

		/**
		 * 判断滑动条是否可用
		 * @method isEnabled
		 * @returns {Boolean}
		 */
		isEnabled: function() {
			return this.enabled;
		}
	};

	var publicMethods = {
		getValue : Slider.prototype.getValue,
		setValue : Slider.prototype.setValue,
		destroy : Slider.prototype.destroy,
		disable : Slider.prototype.disable,
		enable : Slider.prototype.enable,
		toggle : Slider.prototype.toggle,
		isEnabled: Slider.prototype.isEnabled
	};

	$.fn.slider = function (option) {
		if (typeof option === &#x27;string&#x27;) {
			var args = Array.prototype.slice.call(arguments, 1);
			return invokePublicMethod.call(this, option, args);
		} else {
			return createNewSliderInstance.call(this, option);
		}
	};

	function invokePublicMethod(methodName, args) {
		if(publicMethods[methodName]) {
			var sliderObject = retrieveSliderObjectFromElement(this);
			var result = publicMethods[methodName].apply(sliderObject, args);

			if (typeof result === &quot;undefined&quot;) {
				return $(this);
			} else {
				return result;
			}
		} else {
			throw new Error(&quot;method &#x27;&quot; + methodName + &quot;()&#x27; does not exist for slider.&quot;);
		}
	}

	function retrieveSliderObjectFromElement(element) {
		var sliderObject = $(element).data(&#x27;koala.slider&#x27;);
		if(sliderObject &amp;&amp; sliderObject instanceof Slider) {
			return sliderObject;
		} else {
			throw new Error(ErrorMsgs.callingContextNotSliderInstance);
		}
	}

	function createNewSliderInstance(opts) {
		var $this = $(this);
		$this.each(function() {
			var $this = $(this),
				data = $this.data(&#x27;koala.slider&#x27;),
				options = typeof opts === &#x27;object&#x27; &amp;&amp; opts;
			if (!data)  {
				$this.data(&#x27;koala.slider&#x27;, (data = new Slider(this, $.extend({}, $.fn.slider.defaults,options))));
			}
		});
		return $this;
	}

	$.fn.slider.defaults = {
		/**
		 * 最小值
		 * @property min
		 * @type Integer
		 * @default 0
		 */
		min: 0,
		/**
		 * 最大值
		 * @property max
		 * @type Integer
		 * @default 100
		 */
		max: 100,
		/**
		 * 滑动一次改变的值
		 * @property step
		 * @type Integer
		 * @default 1
		 */
		step: 1,
		/**
		 * 滑动方向
		 * @property orientation
		 * @type String 
		 * @default 默认&#x27;horizontal&#x27;,可选 &#x27;vertical&#x27;代表垂直方向
		 */
		orientation: &#x27;horizontal&#x27;,
		/**
		 * 当前值
		 * @property value
		 * @type Integer
		 * @default 50
		 */
		value: 50,
		/**
		 * 滑动条颜色的位置，选择在滑动点的前面还是后面
		 * @property selection
		 * @type String
		 * @default &#x27;before&#x27;:前面，&#x27;after&#x27;:后面
		 */
		selection: &#x27;before&#x27;,
		/**
		 * 提示框的状态
		 * @property tooltip
		 * @type String
		 * @default 
		 * 	&#x27;show&#x27;:滑动时显示
		 * 	&#x27;hide&#x27;:隐藏
		 * 	&#x27;always&#x27;:一直显示
		 */
		tooltip: &#x27;show&#x27;,
		/**
		 * 滑动条的形状
		 * @property handle
		 * @type String
		 * @default 
		 * 	&#x27;round&#x27;:圆形
		 * 	&#x27;triangle&#x27;:三角形
		 */
		handle: &#x27;round&#x27;,
		/**
		 * 是否反转过来，即左边是最大，右边是最小
		 * @property reversed
		 * @type Boolean
		 * @default false
		 */
		reversed : false,
		/**
		 * 是否可用
		 * @property enabled
		 * @type Boolean
		 * @default true
		 */
		enabled: true,
		/**
		 * 提示框的描述
		 * @property formater
		 * @type function(value)
		 * @default 当前值+value
		 */
		formater: function(value) {
			return &quot;当前值：&quot; + value;
		}
	};

	$.fn.slider.Constructor = Slider;

})( window.jQuery );
    </pre>
</div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
